package computer;

import programs.Program;

public class Computer {
	private Memory memory;
	private Program program;
	private ProgramCounter programCounter;
	
	public Computer(Memory memory) {
		this.memory = memory;
		programCounter = new ProgramCounter();
	}
	
	public void load(Program program) {
		this.program = program;
	}
	
	public void run() {
		while (!programCounter.halt()) {
			program.get(programCounter.value()).execute(memory, programCounter);
		}
	}
}
